package edu.hawaii.senin.iclouds.basics;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests Reaction class.
 * 
 * @author Pavel Senin.
 * 
 */
public class TestReaction {

  private Reaction reaction1;

  /**
   * Makes test fixture.
   * 
   * @throws ReadConfigException if error encountered.
   * 
   */
  @Before
  public void setUp() throws ReadConfigException {

    ArrayList<String> reactants1 = new ArrayList<String>();
    reactants1.add("H");
    reactants1.add("HCO");

    ArrayList<String> products1 = new ArrayList<String>();
    products1.add("H2CO");

    reaction1 = new Reaction("HHCO_H2CO", 0.5D, 0.5D, "DF", reactants1, products1);

  }

  /**
   * Tests getters.
   * 
   */
  @Test
  public void testGetters() {
    assertTrue("Testing get name", "HHCO_H2CO".equals(reaction1.getName()));
    assertTrue("Testing get eBArrier", reaction1.getEBarrier().equals(0.5D));
    assertTrue("Testing get eBArrier", reaction1.getRate().equals(0.5D));

    ArrayList reactants = reaction1.getReactants();
    assertEquals("Checking reactants size", 2, reactants.size());
    assertTrue("Checking reactants", "H".equals(reactants.get(0)));
    assertTrue("Checking reactants", "HCO".equals(reactants.get(1)));

    ArrayList products = reaction1.getProducts();
    assertEquals("Checking reactants size", 1, products.size());
    assertTrue("Checking reactants", "H2CO".equals(products.get(0)));
  }

}
